/**
 *  Magic core 1.2
 *  Author: Mac_J@boarsoft.com
 */
var mac = { Msg: Msg || {} };
if (jQuery)(function() {
	$.extend($.fn, {
		mac : function() {
			var func = arguments[0];
			arguments[0] = this;
			try {
				return eval('mac.' + func).apply(this, arguments);
			} catch (e) {
				alert(func + ': ' +  e);
			}
		},
		seek : function(name) {
			return $(this).find('[name=' + name + ']');
		}
	});
})(jQuery);
mac.getMousePos = function(e){
	var e = e || window.event, d = document
		, de = d.documentElement, db = d.body;
	return {
		x: e.pageX || (e.clientX + (de.scrollLeft || db.scrollLeft)), 
		y: e.pageY || (e.clientY + (de.scrollTop || db.scrollTop))
	}
}
mac.eval = function(str) {
	if (typeof(str) == 'string') {
		return str ? eval('(' + str + ')') : {};
	}
	return str;
};
mac.msg = function(m, p) {
	if (p && p.length) {
		for (var i = 0; i < p.length; i++) {
			var s = p[i] + '';
			if (Msg.status && s.length > 4 && !s.indexOf('Msg.')) {
				s = eval(s);
			}
			m = m.replace('{' + i + '}', s);
		}
	}
	return m;
};